import { observer } from 'mobx-react'
import Home from 'Page/Home'
import Login from 'Page/Login'
import React, { useEffect } from 'react'
import { Redirect, Route, Switch } from 'react-router-dom'
import useStores from 'Stores'
// import Home from '../Pages/Home'
// import Login from '../Pages/Login'
// import useStores from '../Stores'

const Routes = () => {
  const { root } = useStores()
  root.init()
  // useEffect(() => {
  //   console.log('to route')
  //   root.init()
  // }, [])

  return (
    <Switch>
      <Route exact path="/" component={Login} />
      <Route path="/home" component={Home} />
      <Redirect to="/" />
    </Switch>
  )
}

export default observer(Routes)